package com.googlecode.garbagecan.configuration.bean;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.configuration.XMLConfiguration;
import org.apache.commons.configuration.beanutils.BeanDeclaration;
import org.apache.commons.configuration.beanutils.BeanHelper;
import org.apache.commons.configuration.beanutils.XMLBeanDeclaration;

public class User {
	private String username;
	private String password;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public static void main(String[] args) throws Exception {
		File file = new File(User.class.getResource("users.xml").getFile());
		XMLConfiguration xmlConf = new XMLConfiguration(file);
		BeanDeclaration decl = new XMLBeanDeclaration(xmlConf, "users");
		//List list = (List) BeanHelper.createBean(decl);
		//System.out.println(user.getUsername());
		//System.out.println(list);
		System.out.println(xmlConf.getList("users.user[@username]"));
	}
}
